/**  
 * All rights Reserved, Designed By www.tydic.com
 * @Title:  MyConnection.java   
 * @Package com.whnk.quartz.task   
 * @Description:    描述   
 * @author: Durant2035     
 * @date:   2021年5月20日 上午9:59:48   
 * @version V1.0 
 * @Copyright: 
 */
package com.whnk.job.util;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import javax.sql.DataSource;
import java.sql.Connection;


/**
 * @author lenovo
 *
 */
@Component
public class ConnectionUtil {
    private static final Logger logger = LoggerFactory.getLogger(ConnectionUtil.class);
    @Resource
    DataSource dataSource;
	public Connection getConnection() {
        Connection connection = null;
        try {

            connection = dataSource.getConnection();
} catch (Exception e) {
            logger.error("连接数据库失败", e);
        }
        return connection;
    }
}
